<?php
Route::group(['prefix'=>'home','namespace'=>'Home'],function(){//var_dump(Route::get('/index', 'Admin\IndexController@index'));die;
    Route::get('/home_index', 'IndexController@index');
    Route::get('/login', 'LoginController@Fromlogin');
    Route::post('/login_input', 'LoginController@login_input');
    Route::get('/captcha/{tmp}', 'LoginController@captcha');
    Route::get('/member_center','MemberController@member_center');
    Route::get('/change_password','MemberController@change_password');
    Route::get('/logout','LoginController@logout');
    Route::get('/finance_center','FinancecenterController@finance_center');
    Route::get('/my_island','IndexController@my_island');
    Route::post('/new_pwd','MemberController@new_pwd');
    Route::post('/headimg','MemberController@headimg');
    Route::get('/install','TablesController@install');
    Route::get('/export','ExcelController@export');
    Route::get('/loadExcel','ExcelController@loadExcel');
});
Route::group(['middleware'=>'web','prefix'=>'admin','namespace'=>'Admin'],function(){
    Route::post('/login', 'LoginController@login');
    Route::get('/captcha/{tmp}', 'LoginController@captcha');
    Route::get('/logout', 'LoginController@logout');


    Route::get('/chart', 'ChartController@chart');
    Route::get('/menuPower', 'ChartController@menuPower');
    Route::get('/roleedit', 'ChartController@roleedit');
    Route::post('/roleadd', 'ChartController@roleadd');
    Route::get('/roledel', 'ChartController@roledel');
    Route::get('/editPower', 'ChartController@editPower');
    Route::get('/dataMenu', 'ChartController@dataMenu');

    Route::post('/updataPwd', 'SetController@updataPwd');
    Route::get('/structure', 'SetController@structure');
    Route::post('/structureAdd', 'SetController@structureAdd');
    Route::get('/structureEdit', 'SetController@structureEdit');
    Route::get('/structureDel', 'SetController@structureDel');
    Route::get('/getAdmins', 'SetController@getAdmins');
    Route::post('/adminsAdd', 'SetController@adminsAdd');
    Route::get('/adminsEdit', 'SetController@adminsEdit');
    Route::get('/adminsDelete', 'SetController@adminsDelete');


    Route::get('/getmenu', 'MenuController@getmenu');
    Route::post('/menuadd', 'MenuController@menuadd');
    Route::get('/menuedit', 'MenuController@menuedit');
    Route::get('/menuValid', 'MenuController@menuValid');
    Route::get('/getSubMenu', 'MenuController@getSubMenu');
    Route::post('/subMenuAdd', 'MenuController@subMenuAdd');
    Route::get('/subEenuEdit', 'MenuController@subEenuEdit');

    Route::post('/apiadd', 'LoginController@apiadd');
    Route::get('/apilist', 'LoginController@apilist');

    //模拟商品秒杀
    Route::get('/AddUserToRedis', 'SecKillController@AddUserToRedis');
    Route::get('/SecKillTest', 'SecKillController@SecKillTest');
    Route::get('/DoLog', 'SecKillController@DoLog');
});
Route::group([
//    'middleware' => ['cors'],
    'prefix' => 'admin',
    // 'namespace'=>'Admin'
], function () {
    //Route::get('/login', 'LoginController@login');
    Route::any('/', function () {
        $result = [
            'App' => '回家吃饭',
            'Version' => '1.0.1'
        ];
        return $result;
    });

    Route::any('/show', function () {
        // $cab = new \App\cab();
        // $params = $_POST;
        $result = 1;//$cab->getpagelist($params);
        return response($result, 200);
    });
});
